package br.ita.doacoes.view.cadastrodoacoes;

import java.util.List;

import javax.swing.DefaultComboBoxModel;

import br.ita.doacoes.core.cadastrodoacoes.dao.AtendenteDAO;
import br.ita.doacoes.core.cadastrodoacoes.dao.impl.AtendenteDAOImpl;
import br.ita.doacoes.domain.cadastrodoacoes.Atendente;
import br.ita.doacoes.view.cadastrodoacoes.refresher.Refreshable;
import br.ita.doacoes.view.cadastrodoacoes.refresher.Refresher;

public class AtendenteCombo extends DefaultComboBoxModel implements Refreshable {
	AtendenteDAO dao;

	public AtendenteCombo() {
		dao = new AtendenteDAOImpl();
		refresh();
		Refresher.add(this);
	}

	public void refresh() {
		List<Atendente> lista = dao.getList();
		removeAllElements();	
		for (Atendente obj : lista) {
			addElement(obj);
		}
	}
}
